<?php TPL::output('admin/admin_header.tpl.htm'); ?>
<body >
<div id="body-wrapper">
<div id="main-content">
	<div class="clear"></div>
	<div class="content-box">
		<div class="content-box-header">
			<h3><?php if($this->group_id > 0){ ?><?php echo $this->setting[$this->group_id]['group_name']; ?><?php }else{ ?><?php echo $this->crumb['last']['name']; ?><?php } ?></h3>
			<ul class="content-box-tabs">
			</ul>
			<div class="clear"></div>
		</div>
		<div class="content-box-content">

			<div id="notification_box" class="notification success png_bg" style="display:none;">
				<a class="close" href="javascript:;"></a>
				<div name="notification_content"></div>
			</div>

			<div class="tab-content default-tab" id="tab1">
				<form id="_save_form" action="admin/setting/sys_save_ajax/" method="post">
					<fieldset>
					<?php foreach($this->setting as $group_id => $group) { ?>
						
						<?php if ($group['group_line'] && !$this->group_id) { ?>
							<hr style="color:#CCCCCC;">
						<?php } ?>
						
						<?php foreach($group['children'] as $var){ ?>
						
							<?php if ($var['varname'] == "upload_dir") { ?>
								<p>
									<label><?php echo $var['desc']; ?>：(目前网站根目录绝对路径:<?php echo realpath(AWS_PATH . '../'); ?>)</label>
									<input name="<?php echo $var['varname']; ?>" class="text-input small-input" type="text" value="<?php echo $var['value']; ?>"/>
								</p>
							<?php } else if ($var['varname'] == "from_email") { ?>
								<p>
									<label><?php echo $var['desc']; ?>：</label>
									<input name="<?php echo $var['varname']; ?>" class="text-input small-input" type="text" value="<?php echo $var['value']; ?>"/>
								</p>
							<?php } else if ($var['varname'] == "email_type") { ?>
								<p>
									<label><?php echo $var['desc']; ?></label>
									<select class="small-input" name="<?php echo $var['varname']; ?>" style="width:500px;">
										<?php foreach($var['select_list'] as $skey => $val) { ?>
										<option value="<?php echo $val['id']; ?>"<?php if ($var['value'] == $val['id']) { ?> selected=true<?php } ?>><?php echo $val['title']; ?></option>
										<?php } ?>
									</select>
								</p>
								<p>
									<label>接收测试邮箱地址</label>
									<input name="test_email" class="text-input small-input" type="text" value=""/>
									&nbsp;
									<input class="button" type="button" onClick="test_email_setting($('#_save_form'), $(this));" value="  发送测试邮件  " />
								</p>
							<?php } else if ($var['type'] == "checkbox") { ?>
								<p groupid="<?php echo $group_id;?>">
									<label>
									<input type="checkbox" value="1" name="<?php echo $var['varname']; ?>"<?php if ($var['value']=='1') echo " checked=true"; ?>>
									<?php echo $var['desc']; ?>
									</label>
									<p style="color:#999"><?php echo $var['detail']; ?></p>
								</p>
								
							<?php } else { ?>
							
								<p groupid="<?php echo $group_id;?>">
								
									<label><?php echo $var['desc']; ?>：</label>
									
									<?php if ($var['type'] == "string") { ?>
										<input name="<?php echo $var['varname']; ?>" class="text-input small-input" type="text" value="<?php echo $var['value']; ?>"/>
									<?php } else if ($var['type'] == "int") { ?>
										<input name="<?php echo $var['varname']; ?>" class="text-input small-int" type="text" value="<?php echo $var['value']; ?>"/>
									<?php } else if ($var['type'] == "textarea") { ?>
										<textarea name="<?php echo $var['varname']; ?>" cols="100" rows="3" id="<?php echo $var['varname']; ?>"><?php echo $var['value']; ?></textarea>
									<?php } else if ($var['type'] == "bool") { ?>
										<input type="radio" name="<?php echo $var['varname']; ?>" value="Y" <?php if ($var['value']=='Y') echo " checked=true"; ?> />是
										<input type="radio" name="<?php echo $var['varname']; ?>" value="N" <?php if ($var['value']=='N') echo " checked=true"; ?> />否
									<?php } else if ($var['type'] == "select") { ?>
										<select class="small-input" name="<?php echo $var['varname']; ?>">
											<?php foreach($var['select_list'] as $skey => $val) { ?>
												<option value="<?php echo $val['id']; ?>"<?php if ($var['value'] == $val['id']) { ?> selected=true<?php } ?>><?php echo $val['title']; ?></option>
											<?php } ?>
										</select>
									<?php } ?>
								</p>
									
									<?php if ($var['detail']) { ?>
										<p style="color:#999;" groupid="<?php echo $group_id;?>"><?php echo $var['detail']; ?></p>
									<?php } ?>
							<?php } ?>
						<?php } ?>
					<?php } ?>

					<p>
						<input class="button" type="button" onClick="ajax_post($('#_save_form'), _form_process);" value="  保  存  " />
					</p>
					
					</fieldset>
					<div class="clear"></div>
				</form>
			</div>
		</div>
		
		<div class="clear"></div>
		
		<div id="notf_tip" style="display:none;" class="notification png_bg">
			<a href="javascript:;" class="close"><img src="<?php echo G_STATIC_URL;?>/admin/images/icons/cross_grey_small.png" alt="关闭" /></a>
			<div id="notf_cont"></div>
		</div>
		
	</div>
</div>

<script type="text/javascript" src="<?php echo G_STATIC_URL; ?>/admin/js/setting.js"></script>

<?php TPL::output('admin/admin_footer.tpl.htm'); ?>